#include "GaussCoreGenerator.h"
#include <cmath>



GaussCoreGenerator::GaussCoreGenerator ()
	: LinearCoreGenerator (false, 3)
{

}



Core< float > GaussCoreGenerator::getCore (int size, int direction)
{
	if (size != -1)
		setSize (size);

	float r = (float)size / 2;
	Core< float > core (QSize (getSize (), getSize ()));
	for (int i = 0; i < getSize (); ++i)
		for (int j = 0; j < getSize (); ++j) {
			float x = i - core.getCenter ().x ();
			float y = j - core.getCenter ().y ();
			core (i, j) = exp (-0.5 * ((x * x) + (y * y)) / (r * r));
		}

	return core;
}
